﻿using System;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
	// Token: 0x020005BF RID: 1471
	[ExecuteInEditMode]
	[AddComponentMenu("Image Effects/Other/Antialiasing")]
	[RequireComponent(typeof(Camera))]
	public class Antialiasing : PostEffectsBase
	{
		// Token: 0x06001D3C RID: 7484 RVA: 0x0006579C File Offset: 0x0006399C
		public Material CurrentAAMaterial()
		{
			Material result;
			switch (this.mode)
			{
			case AAMode.FXAA2:
				result = this.materialFXAAII;
				break;
			case AAMode.FXAA3Console:
				result = this.materialFXAAIII;
				break;
			case AAMode.FXAA1PresetA:
				result = this.materialFXAAPreset2;
				break;
			case AAMode.FXAA1PresetB:
				result = this.materialFXAAPreset3;
				break;
			case AAMode.NFAA:
				result = this.nfaa;
				break;
			case AAMode.SSAA:
				result = this.ssaa;
				break;
			case AAMode.DLAA:
				result = this.dlaa;
				break;
			default:
				result = null;
				break;
			}
			return result;
		}

		// Token: 0x06001D3D RID: 7485 RVA: 0x00065838 File Offset: 0x00063A38
		public override bool CheckResources()
		{
			base.CheckSupport(false);
			this.materialFXAAPreset2 = base.CreateMaterial(this.shaderFXAAPreset2, this.materialFXAAPreset2);
			this.materialFXAAPreset3 = base.CreateMaterial(this.shaderFXAAPreset3, this.materialFXAAPreset3);
			this.materialFXAAII = base.CreateMaterial(this.shaderFXAAII, this.materialFXAAII);
			this.materialFXAAIII = base.CreateMaterial(this.shaderFXAAIII, this.materialFXAAIII);
			this.nfaa = base.CreateMaterial(this.nfaaShader, this.nfaa);
			this.ssaa = base.CreateMaterial(this.ssaaShader, this.ssaa);
			this.dlaa = base.CreateMaterial(this.dlaaShader, this.dlaa);
			if (!this.ssaaShader.isSupported)
			{
				base.NotSupported();
				base.ReportAutoDisable();
			}
			return this.isSupported;
		}

		// Token: 0x06001D3E RID: 7486 RVA: 0x000125A1 File Offset: 0x000107A1
		public void OnRenderImage(RenderTexture source, RenderTexture destination)
		{
			if (!this.CheckResources())
			{
				Graphics.Blit(source, destination);
				return;
			}
			if (this.materialFXAAPreset3 != null)
			{
				Graphics.Blit(source, destination, this.materialFXAAPreset3);
				return;
			}
			Graphics.Blit(source, destination);
		}

		// Token: 0x04001628 RID: 5672
		public AAMode mode = AAMode.FXAA3Console;

		// Token: 0x04001629 RID: 5673
		public bool showGeneratedNormals;

		// Token: 0x0400162A RID: 5674
		public float offsetScale = 0.2f;

		// Token: 0x0400162B RID: 5675
		public float blurRadius = 18f;

		// Token: 0x0400162C RID: 5676
		public float edgeThresholdMin = 0.05f;

		// Token: 0x0400162D RID: 5677
		public float edgeThreshold = 0.2f;

		// Token: 0x0400162E RID: 5678
		public float edgeSharpness = 4f;

		// Token: 0x0400162F RID: 5679
		public bool dlaaSharp;

		// Token: 0x04001630 RID: 5680
		public Shader ssaaShader;

		// Token: 0x04001631 RID: 5681
		public Material ssaa;

		// Token: 0x04001632 RID: 5682
		public Shader dlaaShader;

		// Token: 0x04001633 RID: 5683
		public Material dlaa;

		// Token: 0x04001634 RID: 5684
		public Shader nfaaShader;

		// Token: 0x04001635 RID: 5685
		public Material nfaa;

		// Token: 0x04001636 RID: 5686
		public Shader shaderFXAAPreset2;

		// Token: 0x04001637 RID: 5687
		public Material materialFXAAPreset2;

		// Token: 0x04001638 RID: 5688
		public Shader shaderFXAAPreset3;

		// Token: 0x04001639 RID: 5689
		public Material materialFXAAPreset3;

		// Token: 0x0400163A RID: 5690
		public Shader shaderFXAAII;

		// Token: 0x0400163B RID: 5691
		public Material materialFXAAII;

		// Token: 0x0400163C RID: 5692
		public Shader shaderFXAAIII;

		// Token: 0x0400163D RID: 5693
		public Material materialFXAAIII;
	}
}
